package com.czy.workflow.core.model;

public enum OperationType {

    /**
     * 开始
     */
    START("start"),

    /**
     * 结束
     */
    END("end"),

    /**
     * 系统默认(忽略用户选择，使用表达式校验)
     */
    AUTO("auto"),

    /**
     * 用户选择
     */
    OPTION("option"),


    ;


    private String code;

    OperationType(String code) {
        this.code = code;
    }

    public static OperationType newInstance(String type){
        for(OperationType tmp : OperationType.values()){
            if(tmp.code.equals(type)){
                return tmp;
            }
        }
        return null;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    @Override
    public String toString() {
        return getCode();
    }
}
